![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
The 'address' npm package is a utility for retrieving detailed information about the network interfaces of the host machine. It can be used to get IP addresses, MAC addresses, and DNS servers, among other things. This package is particularly useful for applications that need to be aware of the network configuration of the host they are running on.
Get IP Address
This feature allows you to retrieve the IPv4 or IPv6 address of the host machine. It's useful for applications that need to know their own IP address, for instance, to communicate with other services in a network.
const address = require('address');
// Get the IPv4 address
address.ip(); // '192.168.0.2'
// Get the IPv6 address
address.ipv6(); // 'fe80::7ca0:ab22:703a:b329'
Get MAC Address
This feature enables you to get the MAC address of the host machine. This can be useful for applications that need to identify the network interface of the host.
const address = require('address');
// Get the MAC address
address.mac(function (err, addr) {
console.log(addr); // '78:ca:39:b0:e6:7c'
});
Get DNS Servers
This feature provides the DNS servers configured on the host machine. It's useful for applications that need to perform DNS lookups or need to know about the network's DNS configuration.
const address = require('address');
// Get DNS servers
console.log(address.dns()); // ['8.8.8.8', '8.8.4.4']
The 'ip' package is similar to 'address' in that it provides utilities for IP address manipulation and querying. However, it focuses more on the manipulation and calculation of IP addresses rather than retrieving network interface details.
The 'network' package offers functionality to get network information such as the user's IP, MAC address, and network interfaces, similar to 'address'. However, it also includes additional features like checking internet connectivity, which 'address' does not provide.
While not a third-party package, Node.js's built-in 'os' module provides some overlapping functionality with 'address', such as retrieving network interfaces. However, 'address' offers more detailed and specific network information retrieval capabilities.
Get current machine IP, MAC and DNS servers.
DNS servers receive from /etc/resolv.conf
.
$ npm install address
Get IP is sync and get MAC is async for now.
const address = require('address');
// default interface 'eth' on linux, 'en' on osx.
address.ip(); // '192.168.0.2'
address.ipv6(); // 'fe80::7aca:39ff:feb0:e67d'
address.mac(function (err, addr) {
console.log(addr); // '78:ca:39:b0:e6:7d'
});
// local loopback
address.ip('lo'); // '127.0.0.1'
// vboxnet MAC
address.mac('vboxnet', function (err, addr) {
console.log(addr); // '0a:00:27:00:00:00'
});
address((err, addrs) => {
console.log(addrs.ip, addrs.ipv6, addrs.mac);
// '192.168.0.2', 'fe80::7aca:39ff:feb0:e67d', '78:ca:39:b0:e6:7d'
});
address('vboxnet', (err, addrs) => {
console.log(addrs.ip, addrs.ipv6, addrs.mac);
// '192.168.56.1', null, '0a:00:27:00:00:00'
});
address.interface('IPv4', 'eth1');
// { address: '192.168.1.1', family: 'IPv4', mac: '78:ca:39:b0:e6:7d' }
address.dns((err, addrs) => {
console.log(addrs);
// ['10.13.2.1', '10.13.2.6']
});
fengmk2 | alsotang | jkelleyrtp | mariodu | mathieutu | zhangyuheng |
---|---|---|---|---|---|
coolme200 | whxaxes |
This project follows the git-contributor spec, auto updated at Tue Sep 13 2022 09:09:11 GMT+0800
.
1.2.2 (2022-12-17)
fixes
c316a04
] - fix: local addresses should be ignored on interface (#32) (Jon Kelley <jkelleyrtp@gmail.com>)others
823b70c
] - 🤖 TEST: Run test on GitHub action (#27) (fengmk2 <fengmk2@gmail.com>)2b5fb44
] - Create codeql-analysis.yml (fengmk2 <fengmk2@gmail.com>)features
fe81a41
] - feat: address.ip() supports node 18 (#26) (Yuheng Zhang <zhangyuheng91@gmail.com>)fixes
304754e
] - fix: fix declarations (#20) (吖猩 <whxaxes@qq.com>)fixes
19884ff
] - fix: update d.ts (#18) (MarioDu <dujiakun@gmail.com>)features
7544592
] - feat: Add typings (#15) (Mathieu TUDISCO <oss@mathieutu.dev>)fixes
ed491c5
] - fix: ignore wrong mac address on node 8.x (#10) (fengmk2 <fengmk2@gmail.com>)FAQs
Get current machine IP, MAC and DNS servers.
The npm package address receives a total of 0 weekly downloads. As such, address popularity was classified as not popular.
We found that address demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.